
import 'package:flutter/material.dart';

class CustomThemeApp extends StatelessWidget{

  @override
  Widget build(BuildContext context) {

    final appName = 'Custom Themes';
    return new MaterialApp(
      title: appName,
      theme: ThemeData(
        brightness: Brightness.dark,
        primaryColor: Colors.blueAccent[700],
        accentColor: Colors.cyan[600],
      ),
      home: new HomePage(title: appName,),
    );
  }
}

class HomePage extends StatelessWidget{

  HomePage({Key key, this.title}) : super(key : key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(title),
      ),
      body: new Center(
        child: new Container(
          color: Theme.of(context).accentColor,
          child: new Text('text with a background color',
          style: Theme.of(context).textTheme.title,),
        ),
      ),
      floatingActionButton: new Theme(
          data: Theme.of(context).copyWith(accentColor: Colors.yellow),
          child: new FloatingActionButton(
            onPressed: null,
            child: new Icon(Icons.add),
          )
      ),
    );
  }

}